*Figure 1: distribution of milcas var
hist deathlog

*Table 1: Operationalization of main vars
sum dmilscale
sum deathlog
sum dseatshare
sum wardeaths
tab inoff
tab parfam3
tab post911

*Figure 2: Boxplot of party family
graph box milscale if parfam!=90, over(parfam)

*Table 2 - Model 1 : no interaction
xtgls dmilscale c.deathlog##i.inoff i.parfam3 post911 wardeaths dseatshare, c(psar1) panels(h) force
margins, dydx(deathlog) at(inoff=(0(1)1)) post
** copy/paste margins output to .csv file
* use the text/columns option to place each data point in separate column
* replace 1-2 with two columns (family and gov) respectively 1 = General & Opposition, 2 = General & Government. 
* Delete 4th column with t-values, replace p-values with * if p<.1, otherwise empty.


*Table2 - Model 2: Threeway interaction: in office /w parfam
xtgls dmilscale c.deathlog##i.inoff##i.parfam3 post911 wardeaths dseatshare, c(psar1) panels(h) force
margins, dydx(deathlog) at(inoff=(0(1)1) parfam3=(0(1)2)) post
** copy/paste margins output to same .csv file as on line 83 (paste it in the rows below)
* use the text/columns option to place each data point in separate column
* replace 1-6 with two columns (family and gov) respectively 1 = Left-wing & Opposition, 2 = Right-wing & Opposition, 3 = Ecologist/Socialist & Opposition,
* 4 = Left-wing & Government, 5 = Right-wing & Government, 6 = Ecologist/Socialist & Government. Delete 4th column with t-values, replace p-values with * if p<.1, otherwise empty.
* Save .csv file as results_interaction.csv


*ROBUSTNESS CHECKS*

*Table 4 - Model 3: EXCL US twoway interaction
xtgls dmilscale i.inoff##c.deathlog i.parfam3 post911 wardeaths dseatshare if countryn!=61, c(psar1) panels(h) force
*margins used for figure 1
margins, dydx(inoff) at(deathlog=(0(1)8)) post
*Table 4 - Model 4: EXCL US Threeway interaction: in office /w parfam
xtgls dmilscale c.deathlog##i.inoff##i.parfam3 post911 wardeaths dseatshare if countryn!=61, c(psar1) panels(h) force
*margins used for figure 1
margins, dydx(deathlog) at(inoff=(0(1)1) parfam3=(0(1)2)) post


*Table 5 - Model 5: BEFORE 911 - 2way
xtgls dmilscale c.deathlog##i.inoff i.parfam3 wardeaths dseatshare if post911==0, c(psar1) panels(h) force
*Table 5 - Model 6: BEFORE 911 - Threeway interaction: in office /w parfam
xtgls dmilscale c.deathlog##i.inoff##i.parfam3 wardeaths dseatshare if post911==0, c(psar1) panels(h) force

*Table 6 -  model 7: AFTER 911 - 2way
xtgls dmilscale c.deathlog##i.inoff i.parfam3 wardeaths dseatshare if post911==1, c(psar1) panels(h) force
*Table 6 -  model 8:  AFTER 911 - Threeway interaction: in office /w parfam
xtgls dmilscale c.deathlog##i.inoff##i.parfam3 wardeaths dseatshare if post911==1, c(psar1) panels(h) force

*Table 7 - Model 9: ABSOLUTE NUMBERS - 2way
xtgls dmilscale i.inoff##c.deaths_elec i.parfam3 post911 sum_genocide_battle_deaths dseatshare, c(psar1) panels(h) force
margins, dydx(inoff) at(deaths_elec=(0(250)3356)) post
*Model 7 - model 10: ABSOLUTE NUMBERS - Threeway interaction: in office /w parfam
xtgls dmilscale c.deaths_elec##i.inoff##i.parfam3 post911 sum_genocide_battle_deaths dseatshare, c(psar1) panels(h) force
margins, dydx(deaths_elec) at(inoff=(0(1)1) parfam3=(0(1)2)) post

*Table 8 - model 11: control for majority government
xtgls dmilscale c.deathlog##i.inoff i.parfam3 wardeaths majority, c(psar1) panels(h) force

*Table 9 - model 12: CONTROL POPULARITY - 2way
xtgls dmilscale c.deathlog##i.inoff i.parfam3 wardeaths dseatshare popularity, c(psar1) panels(h) force
*Table 9 -  model 13:  CONTROL POPULARITY - Threeway interaction: in office /w parfam 
xtgls dmilscale c.deathlog##i.inoff##i.parfam3 wardeaths dseatshare popularity, c(psar1) panels(h) force

*Table 11 -  model4
*Threeway interaction: in office /w rile
xtgls dmilscale c.deathlog##i.inoff##c.rile post911 wardeaths dseatshare, c(psar1) panels(h) force
margins, dydx(deathlog) at(inoff=(0(1)1) rile=(-20(10)20)) post
